package org.apache.lucene.search;

import java.util.Arrays;

/**
 * This class extends TopDocs to provide a type-guaranteed
 * reference to the KeyScoreDoc array. 
 * 
 * The original ScoreDoc[]scoreDocs array points to the same array.
 * 
 * @author Joel Wilson
 *
 */
public class TopKeyDocs extends TopDocs {

	private static final long serialVersionUID = 1L;
	
	public final String[] keys;
	
	public TopKeyDocs(int totalHits, KeyScoreDoc[] keyScoreDocs, String[] keys, float maxScore) {
		super(totalHits, keyScoreDocs, maxScore);
		this.keys = keys;
	}

	public TopKeyDocs(int totalHits, KeyScoreDoc[] keyScoreDocs, String[] keys) {
		super(totalHits, keyScoreDocs);
		this.keys = keys;
	}

	@Override
	public String toString() {
		return "TopKeyDocs [totalHits="
				+ totalHits + ", maxScore=" + getMaxScore() + ", scoreDocs=" + Arrays.toString(scoreDocs)
					+ "]";
	}

}
